import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import path from 'path';

export default defineConfig({
	plugins: [uni()],
	css: {
		preprocessorOptions: {
			less: {
				// 全局导入变量文件
				additionalData: `@import "${path.resolve(__dirname, 'static/styles/variables.less')}";`,
				// 或者使用相对路径
				// additionalData: `@import "@/static/styles/variables.less";`,
			},
			scss: {
				// 如果同时使用 SCSS，也可以配置全局变量
				additionalData: `@import "@/uni.scss";`,
			},
		},
	},
	build: {
		minify: 'terser',
		terserOptions: {
			compress: {
				drop_console: true,
			},
		},
	},
});
